{  Statement: http://acmp.ru/?main=task&id_task=267
   Verdict: Accepted
}
uses
  SysUtils, Math;

var
  n,x,y,ans,kk,ct,cx,cy,t:int64;

procedure swap(var a,b:int64);

var
  t:int64;

begin
t := a;
a := b;
b := t;
end;

function gcd(a,b : int64) : int64;
begin
if a < b then swap(a,b);
while b > 0 do begin
  a := a mod b;
  swap(a,b);
end;
result := a;
end;

function lcm(a,b:int64):int64;
begin
result := a * b div gcd(a, b);
end;

begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n,x,y);
if x > y then swap(x,y);
ans := x;
dec(n);
t := lcm(x, y);
kk := t div x + t div y;
inc(ans, t * (n div kk));
n := n mod kk;
if n > 0 then begin
  dec(n);
  ct := x;
  cx := x;
  cy := 0;
  while n > 0 do begin
    if cx < ct then begin
      inc(cx, x);
      ct := max(ct, cx);
      dec(n);
    end else
    if cy < ct then begin
      inc(cy, y);
      ct := max(ct, cy);
      dec(n);
    end;
  end;
  inc(ans, ct);
end;
write(ans);
end.